package com.chen.product.service;

import com.chen.product.api.UserDto;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * 在Feign中使用Hystrix回退
 */
@FeignClient(name = "USER-SERVICE", fallback = UserServiceFallback.class)
public interface UserServiceFeign {
    @RequestMapping(value = "/users", method = RequestMethod.GET)
    List<UserDto> findAll();
    @RequestMapping(value = "/users/{id}",method = RequestMethod.GET)
    UserDto load(@PathVariable("id") Long id);
}
